﻿@model Zor_Web.Models.Browse.V_TenantPersonHousBrowse
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>租户[个人]浏览</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
</head>
<body>
    <div class="layui-tab layui-tab-brief main-tab-container">
    <div class="col-sm-12 ct-padding">
        <button id="btnSearch" class="layui-btn  layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-search"></span>查询</button>
    </div>
    <div class="col-sm-12  layui-tab-content">
        <table class="layui-table" lay-skin="line">
            <thead>
                <tr>
                    <th hidden></th>
                    <th>街道办</th>
                    <th>社区</th>
                    <th>租户姓名</th>
                    <th>身份证号</th>
                    <th>性别</th>
                    <th>联系电话</th>
                    <th>工作单位</th>
                    <th>职业</th>
                    <th>人口性质</th>
                    <th>管理代码</th>
                </tr>
            </thead>
            <tbody id="accordion">
                @foreach (var item in Model.PageData)
                {
                    <tr>
                        <td hidden>@item.Tenant_Id</td>
                        <td>@item.StreetOffice</td>
                        <td>@item.Community</td>
                        <td>@item.Tenant_Name</td>
                        <td>@item.Tenant_IDNumber</td>
                        <td>@item.Tenant_Sex</td>
                        <td>@item.Tenant_Phone</td>
                        <td>@item.Tenant_Company</td>
                        <td>@item.Tenant_Vocation</td>
                        <td>@item.Tenant_Nature</td>
                        <td>@item.Tenant_Code</td>
                    </tr>
                }
            </tbody>
        </table>
        <div class="row">
            <div class="col-sm-9">
                @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "", @class = "pagination" })
            </div>
            <div class="col-sm-3">
                共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
            </div>
        </div>
    </div>
    </div>
    <!-- 模态:查询 -->
    @using (Html.BeginForm("TenantPersonHousBrowse", "Browse", new RouteValueDictionary { { "Model", Model } }, FormMethod.Get))
    {
        <div id="QueryModal" style="display: none;padding: 20px;">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">街道办：</label>
                    <div class="col-sm-4">
                        <select name="StreetOffice" class="form-control" id="StreetOffice"></select>
                    </div>
                    <label class="col-sm-2 layui-form-label">社区：</label>
                    <div class="col-sm-4">
                        <select class="form-control" name="Community" id="Community"></select>
                    </div>
                </div>       
                
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">租户姓名：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_Name" value="@Model.Tenant_Name">
                    </div>
                    <label class="col-sm-2 layui-form-label">身份证号：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_IDNumber" value="@Model.Tenant_IDNumber">
                    </div>
                </div>
               
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">联系电话：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_Phone" value="@Model.Tenant_Phone">
                    </div>
                    <label class="col-sm-2 layui-form-label">工作单位：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_Company" value="@Model.Tenant_Company">
                    </div>
                </div>
                
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">职业：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_Vocation" value="@Model.Tenant_Vocation">
                    </div>
                    <label class="col-sm-2 layui-form-label">人口性质：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_Nature" value="@Model.Tenant_Nature">
                    </div>
                </div>                  
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">管理代码：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="Tenant_Code" value="@Model.Tenant_Code">
                    </div>
                </div>               
            </form>
            <div class="box-footer">
                <button type="submit" id="btnQuery" class="btn btn-info pull-right">
                    <i class="fa fa-search"></i>查询
                </button>
            </div>
        </div>
    }
</body>
</html>
<script>
    /**
     * 查询
     **/
    $(function () {
        $("#btnSearch").click(function () {
            GetStreetOffice();
            GetCommunity();
            LayerOpen('780px', '350px', '查询条件', $('#QueryModal'));//打开查询信息模态框          
        })
    })
    //获取当前社区名称
    function GetCommunity() {
        getAjax("/Browse/SelectCommunity", "", function (data) {
            accordionJson = eval("(" + data + ")");
            $("#Community").append("<option value='' >---     选择社区    ---</option>")
            $.each(accordionJson, function (i) {
                $("#Community").append("<option value='" + accordionJson[i].Dt_Name + "' >" + accordionJson[i].Dt_Name + "</option>");
            });
        });

    }
    //获取当前街道办
    function GetStreetOffice() {
        getAjax("/Browse/SelectStreetOffice", "", function (data) {
            accordionJson = eval("(" + data + ")");
            $.each(accordionJson, function (i) {
                $("#StreetOffice").append("<option value='" + accordionJson[i].Dt_Name + "' >" + accordionJson[i].Dt_Name + "</option>");
            });
        });
    }
</script>